import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { OrderVO, OrderForm, OrderQuery } from '@/api/system/order/types';
import {param} from "@/utils";

/**
 * 查询球星卡订单列表
 * @param query
 * @returns {*}
 */

export const listOrder = (query?: OrderQuery): AxiosPromise<OrderVO[]> => {
  return request({
    url: '/system/cardOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询球星卡订单详细
 * @param id
 */
export const getOrder = (id: string | number): AxiosPromise<OrderVO> => {
  return request({
    url: '/system/cardOrder/getCardOrderInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增球星卡订单
 * @param data
 */
export const addOrder = (data: OrderForm) => {
  return request({
    url: '/system/cardOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改球星卡订单
 * @param data
 */
export const updateOrder = (data: OrderForm) => {
  return request({
    url: '/system/cardOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除球星卡订单
 * @param id
 */
export const delOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/cardOrder/' + id,
    method: 'delete'
  });
};

/**
 * 查看卡密
 * @param param
 */
export const getCardOrdersDetailByOrdersId = (param : any) => {
  return request({
    url: '/system/cardOrder/getCardOrdersDetailByOrdersId',
    method: 'get',
    params: param
  });
};

/**
 * 专属查看卡密
 * @param param
 */
export const getCardOrdersDetailByPermission = (param : any) => {
  return request({
    url: '/system/cardOrder/getCardOrdersDetailByOrdersId',
    method: 'get',
    params: param
  });
};
